home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume29 / zsh2.2 / part17 < prev    next >
Encoding:
Text File  |  1992-05-13  |  47.2 KB  |  2,278 lines

  1. Newsgroups: comp.sources.misc
  2. From: pfalstad@phoenix.Princeton.EDU (Paul Falstad)
  3. Subject:  v29i113:  zsh2.2 - The Z shell, Part17/17
  4. Message-ID: <1992May13.161122.11272@sparky.imd.sterling.com>
  5. X-Md4-Signature: 9818c2e325b5a02a67e832feaeaf6758
  6. Date: Wed, 13 May 1992 16:11:22 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: pfalstad@phoenix.Princeton.EDU (Paul Falstad)
  10. Posting-number: Volume 29, Issue 113
  11. Archive-name: zsh2.2/part17
  12. Environment: BSD
  13. Supersedes: zsh2.1: Volume 24, Issue 1-19
  14.  
  15. #!/bin/sh
  16. # this is aa.17 (part 17 of zsh2.2)
  17. # do not concatenate these parts, unpack them in order with /bin/sh
  18. # file zsh2.2/src/zle_misc.c continued
  19. #
  20. if test ! -r _shar_seq_.tmp; then
  21.     echo 'Please unpack part 1 first!'
  22.     exit 1
  23. fi
  24. (read Scheck
  25.  if test "$Scheck" != 17; then
  26.     echo Please unpack part "$Scheck" next!
  27.     exit 1
  28.  else
  29.     exit 0
  30.  fi
  31. ) < _shar_seq_.tmp || exit 1
  32. if test ! -f _shar_wnt_.tmp; then
  33.     echo 'x - still skipping zsh2.2/src/zle_misc.c'
  34. else
  35. echo 'x - continuing file zsh2.2/src/zle_misc.c'
  36. sed 's/^X//' << 'SHAR_EOF' >> 'zsh2.2/src/zle_misc.c' &&
  37. X *
  38. X * Permission is hereby granted to copy, reproduce, redistribute or otherwise
  39. X * use this software as long as: there is no monetary profit gained
  40. X * specifically from the use or reproduction of this software, it is not
  41. X * sold, rented, traded or otherwise marketed, and this copyright notice is
  42. X * included prominently in any copy made. 
  43. X *
  44. X * The author make no claims as to the fitness or correctness of this software
  45. X * for any use whatsoever, and it is provided as is. Any use of this software
  46. X * is at the user's own risk. 
  47. X *
  48. X */
  49. X
  50. X#define ZLE
  51. X#include "zsh.h"
  52. X
  53. X
  54. Xvoid selfinsert() /**/
  55. X{
  56. Xint ncs = cs+mult;
  57. X
  58. X    if (mult < 0) { mult = -mult; ncs = cs; }
  59. X    if (insmode || ll == cs)
  60. X        spaceinline(mult);
  61. X    else if (mult+cs > ll)
  62. X        spaceinline(ll-(mult+cs));
  63. X    while (mult--)
  64. X        line[cs++] = c;
  65. X    cs = ncs;
  66. X}
  67. X
  68. Xvoid selfinsertunmeta() /**/
  69. X{
  70. X    c &= 0x7f;
  71. X    if (c == '\r') c = '\n';
  72. X    selfinsert();
  73. X}
  74. X
  75. Xvoid deletechar() /**/
  76. X{
  77. X    if (mult < 0) { mult = -mult; backwarddeletechar(); return; }
  78. X    if (c == 4 && !ll)
  79. X        {
  80. X        eofsent = 1;
  81. X        return;
  82. X        }
  83. X    if (!(cs+mult > ll || line[cs] == '\n'))
  84. X        {
  85. X        cs += mult;
  86. X        backdel(mult);
  87. X        }
  88. X    else
  89. X        feep();
  90. X}
  91. X
  92. Xvoid backwarddeletechar() /**/
  93. X{
  94. X    if (mult < 0) { mult = -mult; deletechar(); return; }
  95. X    if (mult > cs)
  96. X        mult = cs;
  97. X    backdel(mult);
  98. X}
  99. X
  100. Xvoid videletechar() /**/
  101. X{
  102. X    if (mult < 0) { mult = -mult; vibackwarddeletechar(); return; }
  103. X    if (c == 4 && !ll) {
  104. X        eofsent = 1;
  105. X        return;
  106. X    }
  107. X    if (!(cs+mult > ll || line[cs] == '\n')) {
  108. X        cs += mult;
  109. X        backkill(mult,0);
  110. X        if (cs && (cs == ll || line[cs] == '\n')) cs--;
  111. X    } else
  112. X        feep();
  113. X}
  114. X
  115. Xvoid vibackwarddeletechar() /**/
  116. X{
  117. X    if (mult < 0) { mult = -mult; videletechar(); return; }
  118. X    if (mult > cs)
  119. X        mult = cs;
  120. X    if (cs-mult < viinsbegin) { feep(); return; }
  121. X    backkill(mult,1);
  122. X}
  123. X
  124. Xvoid vikillline() /**/
  125. X{
  126. X    if (viinsbegin > cs) { feep(); return; }
  127. X    backdel(cs-viinsbegin);
  128. X}
  129. X
  130. Xvoid killwholeline() /**/
  131. X{
  132. Xint i,fg;
  133. X
  134. X    if (mult < 0) return;
  135. X    while (mult--)
  136. X        {
  137. X        if (fg = (cs && cs == ll))
  138. X            cs--;
  139. X        while (cs && line[cs-1] != '\n') cs--;
  140. X        for (i = cs; i != ll && line[i] != '\n'; i++);
  141. X        forekill(i-cs+(i != ll),fg);
  142. X        }
  143. X}
  144. X
  145. Xvoid killbuffer() /**/
  146. X{
  147. X    cs = 0;
  148. X    forekill(ll,0);
  149. X}
  150. X
  151. Xvoid backwardkillline() /**/
  152. X{
  153. Xint i = 0;
  154. X
  155. X    if (mult < 0) { mult = -mult; killline(); return; }
  156. X    while (mult--)
  157. X        {
  158. X        while (cs && line[cs-1] != '\n') cs--,i++;
  159. X        if (mult && cs && line[cs-1] == '\n')
  160. X            cs--,i++;
  161. X        }
  162. X    forekill(i,1);
  163. X}
  164. X
  165. Xvoid gosmacstransposechars() /**/
  166. X{
  167. Xint cc;
  168. X
  169. X    if (cs < 2 || line[cs-1] == '\n' || line[cs-2] == '\n')
  170. X        {
  171. X        if (line[cs] == '\n' || line[cs+1] == '\n')
  172. X            {
  173. X            feep();
  174. X            return;
  175. X            }
  176. X        cs += (cs == 0 || line[cs-1] == '\n') ? 2 : 1;
  177. X        }
  178. X    cc = line[cs-2];
  179. X    line[cs-2] = line[cs-1];
  180. X    line[cs-1] = cc;
  181. X}
  182. X
  183. Xvoid transposechars() /**/
  184. X{
  185. Xint cc;
  186. Xint neg = mult < 0;
  187. X
  188. X    if (neg) mult = -mult;
  189. X    while (mult--) {
  190. X        if (cs == 0 || line[cs-1] == '\n') {
  191. X            if (ll == cs || line[cs] == '\n' || line[cs+1] == '\n') {
  192. X                feep();
  193. X                return;
  194. X            }
  195. X            cs++;
  196. X        }
  197. X        if (!neg) {
  198. X            if (cs != ll && line[cs] != '\n') cs++;
  199. X        } else {
  200. X            if (cs != 0 && line[cs-1] != '\n') cs--;
  201. X        }
  202. X        cc = line[cs-2];
  203. X        line[cs-2] = line[cs-1];
  204. X        line[cs-1] = cc;
  205. X    }
  206. X}
  207. X
  208. Xvoid poundinsert() /**/
  209. X{
  210. X    if (*line != '#') {
  211. X        cs = 0;
  212. X        spaceinline(1);
  213. X        *line = '#';
  214. X    } else {
  215. X        cs = 0;
  216. X        foredel(1);
  217. X    }
  218. X    done = 1;
  219. X}
  220. X
  221. Xvoid acceptline() /**/
  222. X{
  223. X    done = 1;
  224. X}
  225. X
  226. Xvoid acceptandhold() /**/
  227. X{
  228. X    pushnode(bufstack,ztrdup((char *) line));
  229. X    stackcs = cs;
  230. X    done = 1;
  231. X}
  232. X
  233. Xvoid killline() /**/
  234. X{
  235. Xint i = 0;
  236. X
  237. X    if (mult < 0) { mult = -mult; backwardkillline(); return; }
  238. X    while (mult--) {
  239. X        if (line[cs] == '\n')
  240. X            cs++,i++;
  241. X        while (cs != ll && line[cs] != '\n') cs++,i++;
  242. X    }
  243. X    backkill(i,0);
  244. X}
  245. X
  246. Xvoid killregion() /**/
  247. X{
  248. X    if (mark > ll)
  249. X        mark = ll;
  250. X    if (mark > cs)
  251. X        forekill(mark-cs,0);
  252. X    else
  253. X        backkill(cs-mark,1);
  254. X}
  255. X
  256. Xvoid copyregionaskill() /**/
  257. X{
  258. X    if (mark > ll)
  259. X        mark = ll;
  260. X    if (mark > cs)
  261. X        cut(cs,mark-cs,0);
  262. X    else
  263. X        cut(mark,cs-mark,1);
  264. X}
  265. X
  266. Xstatic int kct,yankb,yanke;
  267. X
  268. Xvoid yank() /**/
  269. X{
  270. Xint cc;
  271. Xchar *buf = cutbuf;
  272. X
  273. X    if (!cutbuf) {
  274. X        feep();
  275. X        return;
  276. X    }
  277. X    if (mult < 0) return;
  278. X    if (vibufspec) {
  279. X        vibufspec = tolower(vibufspec);
  280. X        vibufspec += (idigit(vibufspec)) ? -'1'+26 : -'a';
  281. X        if (!(buf = vibuf[vibufspec])) {
  282. X            feep();
  283. X            vibufspec = 0;
  284. X            return;
  285. X        }
  286. X        vibufspec = 0;
  287. X    }
  288. X    yankb = cs;
  289. X    while (mult--) {
  290. X        kct = kringnum;
  291. X        cc = strlen(buf);
  292. X        spaceinline(cc);
  293. X        strncpy((char *) line+cs,buf,cc);
  294. X        cs += cc;
  295. X        yanke = cs;
  296. X    }
  297. X}
  298. X
  299. Xvoid viputafter() /**/
  300. X{
  301. Xint cc;
  302. Xchar *buf = cutbuf;
  303. X
  304. X    if (!cutbuf) {
  305. X        feep();
  306. X        return;
  307. X    }
  308. X    if (mult < 0) return;
  309. X    if (vibufspec) {
  310. X        vibufspec = tolower(vibufspec);
  311. X        vibufspec += (idigit(vibufspec)) ? -'1'+26 : -'a';
  312. X        if (!(buf = vibuf[vibufspec])) {
  313. X            feep();
  314. X            vibufspec = 0;
  315. X            return;
  316. X        }
  317. X        vibufspec = 0;
  318. X    }
  319. X    if (strchr(buf,'\n')) {
  320. X        cs = findeol();
  321. X        if (cs == ll) { spaceinline(1); line[cs] = '\n'; }
  322. X    }
  323. X    if (cs != ll) cs++;
  324. X    yankb = cs;
  325. X    while (mult--) {
  326. X        kct = kringnum;
  327. X        cc = strlen(buf);
  328. X        spaceinline(cc);
  329. X        strncpy((char *) line+cs,buf,cc);
  330. X        cs += cc;
  331. X        yanke = cs;
  332. X    }
  333. X    cs = yankb;
  334. X}
  335. X
  336. Xvoid yankpop() /**/
  337. X{
  338. Xint cc;
  339. X
  340. X    if (!(lastcmd & ZLE_YANK) || !kring[kct]) {
  341. X        feep();
  342. X        return;
  343. X    }
  344. X    cs = yankb;
  345. X    foredel(yanke-yankb);
  346. X    cc = strlen(kring[kct]);
  347. X    spaceinline(cc);
  348. X    strncpy((char *) line+cs,kring[kct],cc);
  349. X    cs += cc;
  350. X    yanke = cs;
  351. X    kct = (kct-1) & (KRINGCT-1);
  352. X}
  353. X
  354. Xvoid overwritemode() /**/
  355. X{
  356. X    insmode ^= 1;
  357. X}
  358. X
  359. Xvoid undefinedkey() /**/
  360. X{
  361. X    feep();
  362. X}
  363. X
  364. Xvoid quotedinsert() /**/
  365. X{
  366. X#ifndef TIO
  367. Xstruct sgttyb sob;
  368. X    sob = shttyinfo.sgttyb;
  369. X    sob.sg_flags = (sob.sg_flags|RAW) & ~ECHO;
  370. X    ioctl(SHTTY,TIOCSETN,&sob);
  371. X#endif
  372. X    c = getkey(0);
  373. X#ifndef TIO
  374. X    setterm();
  375. X#endif
  376. X    if (c) selfinsert(); else feep();
  377. X}
  378. X
  379. Xvoid digitargument() /**/
  380. X{
  381. X    if (!(lastcmd & ZLE_ARG))
  382. X        mult = 0;
  383. X    mult = mult*10+(c&0xf);
  384. X    if (lastcmd & ZLE_NEGARG) mult = -mult;
  385. X}
  386. X
  387. Xvoid negargument() /**/
  388. X{
  389. X    if (lastcmd & ZLE_ARG) feep();
  390. X}
  391. X
  392. Xvoid universalargument() /**/
  393. X{
  394. X    if (!(lastcmd & ZLE_ARG))
  395. X        mult = 4;
  396. X    else
  397. X        mult *= 4;
  398. X}
  399. X
  400. Xvoid copyprevword() /**/
  401. X{
  402. Xint len,t0;
  403. X
  404. X    for (t0 = cs-1; t0 >= 0; t0--)
  405. X        if (iword(line[t0]))
  406. X            break;
  407. X    for (; t0 >= 0; t0--)
  408. X        if (!iword(line[t0]))
  409. X            break;
  410. X    if (t0)
  411. X        t0++;
  412. X    len = cs-t0;
  413. X    spaceinline(len);
  414. X    strncpy((char *) line+cs,(char *) line+t0,len);
  415. X    cs += len;
  416. X}
  417. X
  418. Xvoid sendbreak() /**/
  419. X{
  420. X    errflag = done = 1;
  421. X}
  422. X
  423. Xvoid undo() /**/
  424. X{
  425. Xchar *s;
  426. Xstruct undoent *ue;
  427. X
  428. X    ue = undos+undoct;
  429. X    if (!ue->change)
  430. X        {
  431. X        feep();
  432. X        return;
  433. X        }
  434. X    line[ll] = '\0';
  435. X    s = ztrdup((char *) line+ll-ue->suff);
  436. X    sizeline((ll = ue->pref+ue->suff+ue->len)+1);
  437. X    strncpy((char *) line+ue->pref,ue->change,ue->len);
  438. X    strcpy((char *) line+ue->pref+ue->len,s);
  439. X    free(s);
  440. X    ue->change = NULL;
  441. X    undoct = (undoct-1) & (UNDOCT-1);
  442. X    cs = ue->cs;
  443. X}
  444. X
  445. Xvoid quoteregion() /**/
  446. X{
  447. Xchar *s,*t;
  448. Xint x,y;
  449. X
  450. X    if (mark > ll)
  451. X        mark = ll;
  452. X    if (mark < cs)
  453. X        {
  454. X        x = mark;
  455. X        mark = cs;
  456. X        cs = x;
  457. X        }
  458. X    s = hcalloc((y = mark-cs)+1);
  459. X    strncpy(s,(char *) line+cs,y);
  460. X    s[y] = '\0';
  461. X    foredel(mark-cs);
  462. X    t = makequote(s);
  463. X    spaceinline(x = strlen(t));
  464. X    strncpy((char *) line+cs,t,x);
  465. X    mark = cs;
  466. X    cs += x;
  467. X}
  468. X
  469. Xvoid quoteline() /**/
  470. X{
  471. Xchar *s;
  472. X
  473. X    line[ll] = '\0';
  474. X    s = makequote((char *) line);
  475. X    setline(s);
  476. X}
  477. X
  478. Xchar *makequote(s) /**/
  479. Xchar *s;
  480. X{
  481. Xint qtct = 0;
  482. Xchar *l,*ol;
  483. X
  484. X    for (l = s; *l; l++)
  485. X        if (*l == '\'')
  486. X            qtct++;
  487. X    l = ol = halloc((qtct*3)+3+strlen(s));
  488. X    *l++ = '\'';
  489. X    for (; *s; s++)
  490. X        if (*s == '\'')
  491. X            {
  492. X            *l++ = '\'';
  493. X            *l++ = '\\';
  494. X            *l++ = '\'';
  495. X            *l++ = '\'';
  496. X            }
  497. X        else
  498. X            *l++ = *s;
  499. X    *l++ = '\'';
  500. X    *l = '\0';
  501. X    return ol;
  502. X}
  503. X
  504. X#define NAMLEN 70
  505. X
  506. Xint executenamedcommand() /**/
  507. X{
  508. Xchar buf[NAMLEN],*ptr;
  509. Xint len,ch,t0;
  510. X
  511. X    strcpy(buf,"execute: ");
  512. X    ptr = buf+9;
  513. X    len = 0;
  514. X    statusline = buf;
  515. X    refresh();
  516. X    for (;ch = getkey(1);refresh())
  517. X        {
  518. X        switch (ch)
  519. X            {
  520. X            case 8: case 127:
  521. X                if (len)
  522. X                    {
  523. X                    len--;
  524. X                    *--ptr = '\0';
  525. X                    }
  526. X                break;
  527. X            case 23:
  528. X                while (len && (len--, *--ptr != '-'))
  529. X                    *ptr = '\0';
  530. X                break;
  531. X            case 21:
  532. X                len = 0;
  533. X                ptr = buf+9;
  534. X                *ptr = '\0';
  535. X                break;
  536. X            case 10: case 13: goto brk;
  537. X            case 7: case -1: statusline = NULL; return z_undefinedkey;
  538. X            case 9: case 32:
  539. X                {
  540. X                Lklist ll;
  541. X                int ambig = 100;
  542. X
  543. X                heapalloc();
  544. X                ll = newlist();
  545. X                for (t0 = 0; t0 != ZLECMDCOUNT; t0++)
  546. X                    if (strpfx(buf+9,zlecmds[t0].name))
  547. X                        {
  548. X                        int xx;
  549. X
  550. X                        addnode(ll,zlecmds[t0].name);
  551. X                        xx = pfxlen(peekfirst(ll),zlecmds[t0].name);
  552. X                        if (xx < ambig)
  553. X                            ambig = xx;
  554. X                        }
  555. X                permalloc();
  556. X                if (!full(ll))
  557. X                    feep();
  558. X                else if (!nextnode(firstnode(ll)))
  559. X                    {
  560. X                    strcpy(buf+9,peekfirst(ll));
  561. X                    ptr = buf+(len = strlen(buf));
  562. X                    }
  563. X                else
  564. X                    {
  565. X                    strcpy(buf+9,peekfirst(ll));
  566. X                    len = ambig;
  567. X                    ptr = buf+9+len;
  568. X                    *ptr = '\0';
  569. X                    feep();
  570. X                    listmatches(ll,NULL);
  571. X                    }
  572. X                break;
  573. X                }
  574. X            default:
  575. X                if (len == NAMLEN-10 || icntrl(ch))
  576. X                    feep();
  577. X                else
  578. X                    *ptr++ = ch, *ptr = '\0', len++;
  579. X                break;
  580. X            }
  581. X        }
  582. Xbrk:
  583. X    statusline = NULL;
  584. X    ptr = buf+9;
  585. X    for (t0 = 0; t0 != ZLECMDCOUNT; t0++)
  586. X        if (!strcmp(ptr,zlecmds[t0].name))
  587. X            break;
  588. X    if (t0 != ZLECMDCOUNT)
  589. X        return lastnamed = t0;
  590. X    else
  591. X        return z_undefinedkey;
  592. X}
  593. X
  594. Xvoid vijoin() /**/
  595. X{
  596. Xint x;
  597. X
  598. X    if ((x = findeol()) == ll)
  599. X        {
  600. X        feep();
  601. X        return;
  602. X        }
  603. X    cs = x+1;
  604. X    for (x = 1; cs != ll && iblank(line[cs]); cs++,x++);
  605. X    backdel(x);
  606. X    spaceinline(1);
  607. X    line[cs] = ' ';
  608. X}
  609. X
  610. Xvoid viswapcase() /**/
  611. X{
  612. X    if (cs < ll)
  613. X        {
  614. X        int ch = line[cs];
  615. X
  616. X        if (islower(ch))
  617. X            ch = tuupper(ch);
  618. X        else if (isupper(ch))
  619. X            ch = tulower(ch);
  620. X        line[cs++] = ch;
  621. X        }
  622. X}
  623. X
  624. Xvoid vicapslockpanic() /**/
  625. X{
  626. Xchar ch;
  627. X
  628. X    statusline = "press a lowercase key to continue";
  629. X    refresh();
  630. X    do
  631. X        ch = getkey(0);
  632. X    while (!islower(ch));
  633. X}
  634. X
  635. Xvoid visetbuffer() /**/
  636. X{
  637. Xint ch;
  638. X
  639. X    ch = getkey(1);
  640. X    if (!ialnum(ch)) {
  641. X        feep();
  642. X        return;
  643. X    }
  644. X    vibufspec = ch;
  645. X}
  646. X
  647. Xstatic char *bp;
  648. Xstatic int lensb,countp;
  649. X
  650. Xvoid stradd(d) /**/
  651. Xchar *d;
  652. X{
  653. X    while (*bp++ = *d++);
  654. X    bp--;
  655. X}
  656. X
  657. Xint putstr(d) /**/
  658. Xint d;
  659. X{
  660. X    *bp++ = d;
  661. X    if (countp)
  662. X        lensb++;
  663. X    return 0;
  664. X}
  665. X
  666. X#define tstradd(X) \
  667. X    if (termok && unset(SINGLELINEZLE)) { \
  668. X        char tbuf[2048],*tptr = tbuf; \
  669. X        if (tgetstr(X,&tptr)) \
  670. X            tputs(tbuf,1,putstr); \
  671. X    } \
  672. X    break
  673. X
  674. X/* get a prompt string */
  675. X
  676. Xchar *putprompt(fm,lenp) /**/
  677. Xchar *fm;int *lenp;
  678. X{
  679. Xchar *ss,*bl0;
  680. Xstatic char buf1[256],buf2[256],*buf;
  681. Xchar buf3[MAXPATHLEN];
  682. Xint t0,bracepos = 0;
  683. Xstruct tm *tm = NULL;
  684. Xtime_t timet;
  685. X
  686. X    lensb = 0; countp = 1;
  687. X    if (!fm) { *lenp = 0; return ""; }
  688. X    /* kludge alert! */
  689. X    buf = (buf == buf1) ? buf2 : buf1;
  690. X    bp = bl0 = buf;
  691. X    if (!columns) columns = 80;
  692. X    clearerr(stdin);
  693. X    for(;*fm;fm++) {
  694. X        if (bp-buf >= 220)
  695. X            break;
  696. X        if (*fm == '%')
  697. X            switch (*++fm) {
  698. X                case '~':
  699. X                    t0 = finddir(pwd);
  700. X                    if (t0 != -1) {
  701. X                        *bp++ = '~';
  702. X                        stradd(usernames[t0]);
  703. X                        stradd(pwd+strlen(userdirs[t0]));
  704. X                        break;
  705. X                    }
  706. X                    if (!strncmp(pwd,home,t0 = strlen(home)) && t0 > 1) {
  707. X                        *bp++ = '~';
  708. X                        stradd(pwd+t0);
  709. X                        break;
  710. X                    }
  711. X                case 'd': case '/': stradd(pwd); break;
  712. X                case 'c': case '.':
  713. X                    t0 = finddir(pwd);
  714. X                    if (t0 != -1) {
  715. X                        sprintf(buf3,"~%s%s",usernames[t0],
  716. X                            pwd+strlen(userdirs[t0]));
  717. X                    } else if (!strncmp(pwd,home,t0 = strlen(home)) && t0 > 1) {
  718. X                        sprintf(buf3,"~%s",pwd+t0);
  719. X                    } else {
  720. X                        strcpy(buf3,pwd);
  721. X                    }
  722. X                    t0 = 1;
  723. X                    if (idigit(fm[1])) { t0 = fm[1]-'0'; fm++; }
  724. X                    for (ss = buf3+strlen(buf3); ss > buf3; ss--)
  725. X                        if (*ss == '/' && !--t0) {
  726. X                            ss++;
  727. X                            break;
  728. X                        }
  729. X                    if (*ss == '/' && ss[1] && (ss != buf3)) ss++;
  730. X                    stradd(ss);
  731. X                    break;
  732. X                case 'C':
  733. X                    strcpy(buf3,pwd);
  734. X                    t0 = 1;
  735. X                    if (idigit(fm[1])) { t0 = fm[1]-'0'; fm++; }
  736. X                    for (ss = buf3+strlen(buf3); ss > buf3; ss--)
  737. X                        if (*ss == '/' && !--t0) {
  738. X                            ss++;
  739. X                            break;
  740. X                        }
  741. X                    if (*ss == '/' && ss[1] && (ss != buf3)) ss++;
  742. X                    stradd(ss);
  743. X                    break;
  744. X                case 'h': case '!':
  745. X                    sprintf(bp,"%d",curhist);
  746. X                    bp += strlen(bp);
  747. X                    break;
  748. X                case 'M': stradd(hostnam); break;
  749. X                case 'm':
  750. X                    if (idigit(fm[1]))
  751. X                        t0 = (*++fm)-'0';
  752. X                    else
  753. X                        t0 = 1;
  754. X                    for (ss = hostnam; *ss; ss++)
  755. X                        if (*ss == '.' && !--t0)
  756. X                            break;
  757. X                    t0 = *ss;
  758. X                    *ss = '\0';
  759. X                    stradd(hostnam);
  760. X                    *ss = t0;
  761. X                    break;
  762. X                case 'S': tstradd("so"); /* <- this is a macro */
  763. X                case 's': tstradd("se");
  764. X                case 'B': tstradd("md");
  765. X                case 'b': tstradd("me");
  766. X                case 'U': tstradd("us");
  767. X                case 'u': tstradd("ue");
  768. X                case '{': bracepos = bp-buf; countp = 0; break;
  769. X                case '}': lensb += (bp-buf)-bracepos; countp = 1; break;
  770. X                case 't': case '@':
  771. X                    timet = time(NULL);
  772. X                    tm = localtime(&timet);
  773. X                    ztrftime(bp,16,"%l:%M%p",tm);
  774. X                    if (*bp == ' ')
  775. X                        chuck(bp);
  776. X                    bp += strlen(bp);
  777. X                    break;
  778. X                case 'T':
  779. X                    timet = time(NULL);
  780. X                    tm = localtime(&timet);
  781. X                    ztrftime(bp,16,"%k:%M",tm);
  782. X                    bp += strlen(bp);
  783. X                    break;
  784. X                case '*':
  785. X                    timet = time(NULL);
  786. X                    tm = localtime(&timet);
  787. X                    ztrftime(bp,16,"%k:%M:%S",tm);
  788. X                    bp += strlen(bp);
  789. X                    break;
  790. X                case 'n': stradd(username); break;
  791. X                case 'w':
  792. X                    timet = time(NULL);
  793. X                    tm = localtime(&timet);
  794. X                    ztrftime(bp,16,"%a %e",tm);
  795. X                    bp += strlen(bp);
  796. X                    break;
  797. X                case 'W':
  798. X                    timet = time(NULL);
  799. X                    tm = localtime(&timet);
  800. X                    ztrftime(bp,16,"%m/%d/%y",tm);
  801. X                    bp += strlen(bp);
  802. X                    break;
  803. X                case 'D':
  804. X                     strcpy(buf3, "%y-%m-%d");
  805. X                     if (fm[1] == '{') {
  806. X                         for (ss = fm + 1, t0 = 0; *ss; ++ss)
  807. X                             if (*ss == '{')
  808. X                                 ++t0;
  809. X                             else if (*ss == '}')
  810. X                                 if (--t0 == 0)
  811. X                                     break;
  812. X                         if (*ss == '}' && t0 == 0) {
  813. X                             t0 = (ss - 1) - (fm + 1);
  814. X                             strncpy(buf3, fm + 2, t0);
  815. X                             buf3[t0] = 0;
  816. X                             fm = ss;
  817. X                         }
  818. X                     }
  819. X                      timet = time(NULL);
  820. X                      tm = localtime(&timet);
  821. X                     ztrftime(bp,16,buf3,tm);
  822. X                      bp += strlen(bp);
  823. X                      break;
  824. X                case 'l':
  825. X                    if (*ttystrname) stradd((strncmp(ttystrname,"/dev/tty",8) ? 
  826. X                        ttystrname+5 : ttystrname+8));
  827. X                    else stradd("()");
  828. X                    break;
  829. X                case '?':
  830. X                    sprintf(bp,"%d",lastval);
  831. X                    bp += strlen(bp);
  832. X                    break;
  833. X                case '%': *bp++ = '%'; break;
  834. X                case '#': *bp++ = (geteuid()) ? '%' : '#'; break;
  835. X                case 'r': stradd(rstring); break;
  836. X                case 'R': stradd(Rstring); break;
  837. X                default: *bp++ = '%'; *bp++ = *fm; break;
  838. X            }
  839. X        else if (*fm == '!') {
  840. X            sprintf(bp,"%d",curhist);
  841. X            bp += strlen(bp);
  842. X        } else {
  843. X            if (fm[0] == '\\' && fm[1])
  844. X                fm++;
  845. X            if ((*bp++ = *fm) == '\n')
  846. X                bl0 = bp, lensb = 0;
  847. X        }
  848. X    }
  849. X    *lenp = (bp-bl0)-lensb;
  850. X    *lenp %= columns;
  851. X    if (*lenp == columns-1) {
  852. X        *lenp = 0;
  853. X        *bp++ = ' ';
  854. X    }
  855. X    *bp = '\0';
  856. X    return buf;
  857. X}
  858. X
  859. SHAR_EOF
  860. echo 'File zsh2.2/src/zle_misc.c is complete' &&
  861. chmod 0644 zsh2.2/src/zle_misc.c ||
  862. echo 'restore of zsh2.2/src/zle_misc.c failed'
  863. Wc_c="`wc -c < 'zsh2.2/src/zle_misc.c'`"
  864. test 14519 -eq "$Wc_c" ||
  865.     echo 'zsh2.2/src/zle_misc.c: original size 14519, current size' "$Wc_c"
  866. rm -f _shar_wnt_.tmp
  867. fi
  868. # ============= zsh2.2/src/zle_word.c ==============
  869. if test -f 'zsh2.2/src/zle_word.c' -a X"$1" != X"-c"; then
  870.     echo 'x - skipping zsh2.2/src/zle_word.c (File already exists)'
  871.     rm -f _shar_wnt_.tmp
  872. else
  873. > _shar_wnt_.tmp
  874. echo 'x - extracting zsh2.2/src/zle_word.c (Text)'
  875. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/zle_word.c' &&
  876. X/*
  877. X *
  878. X * zle_word.c - word-related editor functions
  879. X *
  880. X * This file is part of zsh, the Z shell.
  881. X *
  882. X * This software is Copyright 1992 by Paul Falstad
  883. X *
  884. X * Permission is hereby granted to copy, reproduce, redistribute or otherwise
  885. X * use this software as long as: there is no monetary profit gained
  886. X * specifically from the use or reproduction of this software, it is not
  887. X * sold, rented, traded or otherwise marketed, and this copyright notice is
  888. X * included prominently in any copy made. 
  889. X *
  890. X * The author make no claims as to the fitness or correctness of this software
  891. X * for any use whatsoever, and it is provided as is. Any use of this software
  892. X * is at the user's own risk. 
  893. X *
  894. X */
  895. X
  896. X#define ZLE
  897. X#include "zsh.h"
  898. X
  899. X
  900. Xvoid forwardword() /**/
  901. X{
  902. X    if (mult < 0) { mult = -mult; backwardword(); return; }
  903. X    while (mult--) {
  904. X        while (cs != ll && iword(line[cs])) cs++;
  905. X        if (wordflag && !mult) return;
  906. X        while (cs != ll && !iword(line[cs])) cs++;
  907. X    }
  908. X}
  909. X
  910. Xvoid viforwardword() /**/
  911. X{
  912. X    if (mult < 0) { mult = -mult; backwardword(); return; }
  913. X    while (mult--) {
  914. X        if (iident(line[cs])) while (cs != ll && iident(line[cs])) cs++;
  915. X        else while (cs != ll && !iident(line[cs]) && !iblank(line[cs])) cs++;
  916. X        if (wordflag && !mult) return;
  917. X        while (cs != ll && iblank(line[cs])) cs++;
  918. X    }
  919. X}
  920. X
  921. Xvoid viforwardblankword() /**/
  922. X{
  923. X    if (mult < 0) { mult = -mult; vibackwardblankword(); return; }
  924. X    while (mult--) {
  925. X        while (cs != ll && !iblank(line[cs])) cs++;
  926. X        if (wordflag && !mult) return;
  927. X        while (cs != ll && iblank(line[cs])) cs++;
  928. X    }
  929. X}
  930. X
  931. Xvoid emacsforwardword() /**/
  932. X{
  933. X    if (mult < 0) { mult = -mult; emacsbackwardword(); return; }
  934. X    while (mult--)
  935. X        {
  936. X        while (cs != ll && !iword(line[cs])) cs++;
  937. X        if (wordflag && !mult) return;
  938. X        while (cs != ll && iword(line[cs])) cs++;
  939. X        }
  940. X}
  941. X
  942. Xvoid viforwardblankwordend() /**/
  943. X{
  944. X    if (mult < 0) return;
  945. X    while (mult--) {
  946. X        while (cs != ll && iblank(line[cs+1])) cs++;
  947. X        while (cs != ll && !iblank(line[cs+1])) cs++;
  948. X    }
  949. X    if (cs != ll && virangeflag) cs++;
  950. X}
  951. X
  952. Xvoid viforwardwordend() /**/
  953. X{
  954. X    if (mult < 0) { mult = -mult; backwardword(); return; }
  955. X    while (mult--) {
  956. X        if (iblank(line[cs+1])) while (cs != ll && iblank(line[cs+1])) cs++;
  957. X        if (iident(line[cs+1])) while (cs != ll && iident(line[cs+1])) cs++;
  958. X        else while (cs != ll && !iident(line[cs+1]) && !iblank(line[cs+1])) cs++;
  959. X    }
  960. X    if (cs != ll && virangeflag) cs++;
  961. X}
  962. X
  963. Xvoid backwardword() /**/
  964. X{
  965. X    if (mult < 0) { mult = -mult; forwardword(); return; }
  966. X    while (mult--) {
  967. X        while (cs && !iword(line[cs-1])) cs--;
  968. X        while (cs && iword(line[cs-1])) cs--;
  969. X    }
  970. X}
  971. X
  972. Xvoid vibackwardword() /**/
  973. X{
  974. X    if (mult < 0) { mult = -mult; backwardword(); return; }
  975. X    while (mult--) {
  976. X        while (cs && iblank(line[cs-1])) cs--;
  977. X        if (iident(line[cs-1])) while (cs && iident(line[cs-1])) cs--;
  978. X        else while (cs && !iident(line[cs-1]) && !iblank(line[cs-1])) cs--;
  979. X    }
  980. X}
  981. X
  982. Xvoid vibackwardblankword() /**/
  983. X{
  984. X    if (mult < 0) { mult = -mult; viforwardblankword(); return; }
  985. X    while (mult--) {
  986. X        while (cs && iblank(line[cs-1])) cs--;
  987. X        while (cs && !iblank(line[cs-1])) cs--;
  988. X    }
  989. X}
  990. X
  991. Xvoid emacsbackwardword() /**/
  992. X{
  993. X    if (mult < 0) { mult = -mult; emacsforwardword(); return; }
  994. X    while (mult--) {
  995. X        while (cs && !iword(line[cs-1])) cs--;
  996. X        while (cs && iword(line[cs-1])) cs--;
  997. X    }
  998. X}
  999. X
  1000. Xvoid backwarddeleteword() /**/
  1001. X{
  1002. Xint x = cs;
  1003. X
  1004. X    if (mult < 0) { mult = -mult; deleteword(); return; }
  1005. X    while (mult--) {
  1006. X        while (x && !iword(line[x-1])) x--;
  1007. X        while (x && iword(line[x-1])) x--;
  1008. X    }
  1009. X    backdel(cs-x);
  1010. X}
  1011. X
  1012. Xvoid vibackwardkillword() /**/
  1013. X{
  1014. Xint x = cs;
  1015. X
  1016. X    if (mult < 0) { feep(); return; }
  1017. X    while (mult--) {
  1018. X        while (x > viinsbegin && !iword(line[x-1])) x--;
  1019. X        while (x > viinsbegin && iword(line[x-1])) x--;
  1020. X    }
  1021. X    backkill(cs-x,1);
  1022. X}
  1023. X
  1024. Xvoid backwardkillword() /**/
  1025. X{
  1026. Xint x = cs;
  1027. X
  1028. X    if (mult < 0) { mult = -mult; killword(); return; }
  1029. X    while (mult--) {
  1030. X        while (x && !iword(line[x-1])) x--;
  1031. X        while (x && iword(line[x-1])) x--;
  1032. X    }
  1033. X    backkill(cs-x,1);
  1034. X}
  1035. X
  1036. Xvoid upcaseword() /**/
  1037. X{
  1038. Xint neg = mult < 0, ocs = cs;
  1039. X
  1040. X    if (neg) mult = -mult;
  1041. X    while (mult--) {
  1042. X        while (cs != ll && !iword(line[cs])) cs++;
  1043. X        while (cs != ll && iword(line[cs])) {
  1044. X            line[cs] = tuupper(line[cs]);
  1045. X            cs++;
  1046. X        }
  1047. X    }
  1048. X    if (neg) cs = ocs;
  1049. X}
  1050. X
  1051. Xvoid downcaseword() /**/
  1052. X{
  1053. Xint neg = mult < 0, ocs = cs;
  1054. X
  1055. X    if (neg) mult = -mult;
  1056. X    while (mult--) {
  1057. X        while (cs != ll && !iword(line[cs])) cs++;
  1058. X        while (cs != ll && iword(line[cs])) {
  1059. X            line[cs] = tulower(line[cs]);
  1060. X            cs++;
  1061. X        }
  1062. X    }
  1063. X    if (neg) cs = ocs;
  1064. X}
  1065. X
  1066. Xvoid capitalizeword() /**/
  1067. X{
  1068. Xint first;
  1069. Xint neg = mult < 0, ocs = cs;
  1070. X    
  1071. X    if (neg) mult = -mult;
  1072. X    while (mult--) {
  1073. X        first = 1;
  1074. X        while (cs != ll && !iword(line[cs])) cs++;
  1075. X        while (cs != ll && iword(line[cs])) {
  1076. X            line[cs] = (first) ? tuupper(line[cs]) : tulower(line[cs]);
  1077. X            first = 0;
  1078. X            cs++;
  1079. X        }
  1080. X    }
  1081. X    if (neg) cs = ocs;
  1082. X}
  1083. X
  1084. Xvoid deleteword() /**/
  1085. X{
  1086. Xint x = cs;
  1087. X
  1088. X    if (mult < 0) { mult = -mult; backwarddeleteword(); return; }
  1089. X    while (mult--) {
  1090. X        while (x != ll && !iword(line[x])) x++;
  1091. X        while (x != ll && iword(line[x])) x++;
  1092. X    }
  1093. X    foredel(x-cs);
  1094. X}
  1095. X
  1096. Xvoid killword() /**/
  1097. X{
  1098. Xint x = cs;
  1099. X
  1100. X    if (mult < 0) { mult = -mult; backwardkillword(); return; }
  1101. X    while (mult--) {
  1102. X        while (x != ll && !iword(line[x])) x++;
  1103. X        while (x != ll && iword(line[x])) x++;
  1104. X    }
  1105. X    forekill(x-cs,0);
  1106. X}
  1107. X
  1108. Xvoid transposewords() /**/
  1109. X{
  1110. Xint p1,p2,p3,p4,x = cs;
  1111. Xchar *temp,*pp;
  1112. Xint neg = mult < 0, ocs = cs;
  1113. X
  1114. X    if (neg) mult = -mult;
  1115. X    while (mult--) {
  1116. X        while (x != ll && line[x] != '\n' && !iword(line[x]))
  1117. X            x++;
  1118. X        if (x == ll || line[x] == '\n') {
  1119. X            x = cs;
  1120. X            while (x && line[x-1] != '\n' && !iword(line[x]))
  1121. X                x--;
  1122. X            if (!x || line[x-1] == '\n') {
  1123. X                feep();
  1124. X                return;
  1125. X            }
  1126. X        }
  1127. X        for (p4 = x; p4 != ll && iword(line[p4]); p4++);
  1128. X        for (p3 = p4; p3 && iword(line[p3-1]); p3--);
  1129. X        if (!p3) {
  1130. X            feep();
  1131. X            return;
  1132. X        }
  1133. X        for (p2 = p3; p2 && !iword(line[p2-1]); p2--);
  1134. X        if (!p2) {
  1135. X            feep();
  1136. X            return;
  1137. X        }
  1138. X        for (p1 = p2; p1 && iword(line[p1-1]); p1--);
  1139. X        pp = temp = halloc(p4-p1+1);
  1140. X        struncpy(&pp,line+p3,p4-p3);
  1141. X        struncpy(&pp,line+p2,p3-p2);
  1142. X        struncpy(&pp,line+p1,p2-p1);
  1143. X        strncpy((char *) line+p1,temp,p4-p1);
  1144. X        cs = p4;
  1145. X    }
  1146. X    if (neg) cs = ocs;
  1147. X}
  1148. SHAR_EOF
  1149. chmod 0644 zsh2.2/src/zle_word.c ||
  1150. echo 'restore of zsh2.2/src/zle_word.c failed'
  1151. Wc_c="`wc -c < 'zsh2.2/src/zle_word.c'`"
  1152. test 6019 -eq "$Wc_c" ||
  1153.     echo 'zsh2.2/src/zle_word.c: original size 6019, current size' "$Wc_c"
  1154. rm -f _shar_wnt_.tmp
  1155. fi
  1156. # ============= zsh2.2/src/zle_hist.c ==============
  1157. if test -f 'zsh2.2/src/zle_hist.c' -a X"$1" != X"-c"; then
  1158.     echo 'x - skipping zsh2.2/src/zle_hist.c (File already exists)'
  1159.     rm -f _shar_wnt_.tmp
  1160. else
  1161. > _shar_wnt_.tmp
  1162. echo 'x - extracting zsh2.2/src/zle_hist.c (Text)'
  1163. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/zle_hist.c' &&
  1164. X/*
  1165. X *
  1166. X * zle_hist.c - history editing
  1167. X *
  1168. X * This file is part of zsh, the Z shell.
  1169. X *
  1170. X * This software is Copyright 1992 by Paul Falstad
  1171. X *
  1172. X * Permission is hereby granted to copy, reproduce, redistribute or otherwise
  1173. X * use this software as long as: there is no monetary profit gained
  1174. X * specifically from the use or reproduction of this software, it is not
  1175. X * sold, rented, traded or otherwise marketed, and this copyright notice is
  1176. X * included prominently in any copy made. 
  1177. X *
  1178. X * The author make no claims as to the fitness or correctness of this software
  1179. X * for any use whatsoever, and it is provided as is. Any use of this software
  1180. X * is at the user's own risk. 
  1181. X *
  1182. X */
  1183. X
  1184. X#define ZLE
  1185. X#include "zsh.h"
  1186. X
  1187. Xvoid toggleliteralhistory() /**/
  1188. X{
  1189. Xchar *s;
  1190. X
  1191. X    if (histline == curhist)
  1192. X        {
  1193. X        if (curhistline)
  1194. X            free(curhistline);
  1195. X        curhistline = ztrdup(line);
  1196. X        }
  1197. X    lithist ^= 1;
  1198. X    if (!(s = qgetevent(histline)))
  1199. X        feep();
  1200. X    else
  1201. X        sethistline(s);
  1202. X}
  1203. X
  1204. Xvoid uphistory() /**/
  1205. X{
  1206. Xchar *s;
  1207. X
  1208. X    if (mult < 0) { mult = -mult; downhistory(); return; }
  1209. X    if (histline == curhist)
  1210. X        {
  1211. X        if (curhistline)
  1212. X            free(curhistline);
  1213. X        curhistline = ztrdup(line);
  1214. X        }
  1215. X    histline -= mult;
  1216. X    if (!(s = qgetevent(histline)))
  1217. X        {
  1218. X        if (unset(NOHISTBEEP)) feep();
  1219. X        histline += mult;
  1220. X        }
  1221. X    else
  1222. X        sethistline(s);
  1223. X}
  1224. X
  1225. Xvoid uplineorhistory() /**/
  1226. X{
  1227. Xint ocs = cs;
  1228. X
  1229. X    if (mult < 0) { mult = -mult; downlineorhistory(); return; }
  1230. X    if ((lastcmd & ZLE_LINEMOVE) != ZLE_LINEMOVE)
  1231. X        lastcol = cs-findbol();
  1232. X    cs = findbol();
  1233. X    while (mult) {
  1234. X        if (!cs)
  1235. X            break;
  1236. X        cs--;
  1237. X        cs = findbol();
  1238. X        mult--;
  1239. X    }
  1240. X    if (mult) {
  1241. X        cs = ocs;
  1242. X        if (virangeflag) {
  1243. X            feep();
  1244. X            return;
  1245. X        }
  1246. X        uphistory();
  1247. X    } else {
  1248. X        int x = findeol();
  1249. X        if ((cs += lastcol) > x)
  1250. X            cs = x;
  1251. X    }
  1252. X}
  1253. X
  1254. Xvoid downlineorhistory() /**/
  1255. X{
  1256. Xint ocs = cs;
  1257. X
  1258. X    if (mult < 0) { mult = -mult; uplineorhistory(); return; }
  1259. X    if ((lastcmd & ZLE_LINEMOVE) != ZLE_LINEMOVE)
  1260. X        lastcol = cs-findbol();
  1261. X    while (mult) {
  1262. X        int x = findeol();
  1263. X        if (x == ll)
  1264. X            break;
  1265. X        cs = x+1;
  1266. X        mult--;
  1267. X    }
  1268. X    if (mult) {
  1269. X        cs = ocs;
  1270. X        if (virangeflag) {
  1271. X            feep();
  1272. X            return;
  1273. X        }
  1274. X        downhistory();
  1275. X    } else {
  1276. X        int x = findeol();
  1277. X        if ((cs += lastcol) > x)
  1278. X            cs = x;
  1279. X    }
  1280. X}
  1281. X
  1282. Xvoid acceptlineanddownhistory() /**/
  1283. X{
  1284. Xchar *s,*t;
  1285. X
  1286. X    if (!(s = qgetevent(histline+1)))
  1287. X        {
  1288. X        feep();
  1289. X        return;
  1290. X        }
  1291. X    pushnode(bufstack,t = ztrdup(s));
  1292. X    for (; *t; t++)
  1293. X        if (*t == HISTSPACE)
  1294. X            *t = ' ';
  1295. X    done = 1;
  1296. X    stackhist = histline+1;
  1297. X}
  1298. X
  1299. Xvoid downhistory() /**/
  1300. X{
  1301. Xchar *s;
  1302. X
  1303. X    if (mult < 0) { mult = -mult; uphistory(); return; }
  1304. X    histline += mult;
  1305. X    if (!(s = qgetevent(histline)))
  1306. X        {
  1307. X        if (unset(NOHISTBEEP)) feep();
  1308. X        histline -= mult;
  1309. X        return;
  1310. X        }
  1311. X    sethistline(s);
  1312. X}
  1313. X
  1314. Xstatic int histpos;
  1315. X
  1316. Xvoid historysearchbackward() /**/
  1317. X{
  1318. Xint t0,ohistline = histline;
  1319. Xchar *s;
  1320. X
  1321. X    if (histline == curhist)
  1322. X        {
  1323. X        if (curhistline)
  1324. X            free(curhistline);
  1325. X        curhistline = ztrdup(line);
  1326. X        }
  1327. X    if (lastcmd & ZLE_HISTSEARCH) t0 = histpos;
  1328. X    else for (t0 = 0; line[t0] && iword(line[t0]); t0++);
  1329. X    histpos = t0;
  1330. X    for (;;)
  1331. X        {
  1332. X        histline--;
  1333. X        if (!(s = qgetevent(histline)))
  1334. X            {
  1335. X            feep();
  1336. X            histline = ohistline;
  1337. X            return;
  1338. X            }
  1339. X        if (!hstrncmp(s,line,t0) && hstrcmp(s,line))
  1340. X            break;
  1341. X        }
  1342. X    sethistline(s);
  1343. X}
  1344. X
  1345. Xvoid historysearchforward() /**/
  1346. X{
  1347. Xint t0,ohistline = histline;
  1348. Xchar *s;
  1349. X
  1350. X    if (histline == curhist)
  1351. X        {
  1352. X        if (curhistline)
  1353. X            free(curhistline);
  1354. X        curhistline = ztrdup(line);
  1355. X        }
  1356. X    if (lastcmd & ZLE_HISTSEARCH) t0 = histpos;
  1357. X    else for (t0 = 0; line[t0] && iword(line[t0]); t0++);
  1358. X    histpos = t0;
  1359. X    for (;;)
  1360. X        {
  1361. X        histline++;
  1362. X        if (!(s = qgetevent(histline)))
  1363. X            {
  1364. X            feep();
  1365. X            histline = ohistline;
  1366. X            return;
  1367. X            }
  1368. X        if (!hstrncmp(s,line,t0) && hstrcmp(s,line))
  1369. X            break;
  1370. X        }
  1371. X    sethistline(s);
  1372. X}
  1373. X
  1374. Xvoid beginningofbufferorhistory() /**/
  1375. X{
  1376. X    if (findbol())
  1377. X        cs = 0;
  1378. X    else
  1379. X        beginningofhistory();
  1380. X}
  1381. X
  1382. Xvoid beginningofhistory() /**/
  1383. X{
  1384. Xchar *s;
  1385. X
  1386. X    if (histline == curhist)
  1387. X        {
  1388. X        if (curhistline)
  1389. X            free(curhistline);
  1390. X        curhistline = ztrdup(line);
  1391. X        }
  1392. X    if (!(s = qgetevent(firsthist())))
  1393. X        {
  1394. X        if (unset(NOHISTBEEP)) feep();
  1395. X        return;
  1396. X        }
  1397. X    histline = firsthist();
  1398. X    sethistline(s);
  1399. X}
  1400. X
  1401. Xvoid endofbufferorhistory() /**/
  1402. X{
  1403. X    if (findeol() != ll)
  1404. X        cs = ll;
  1405. X    else
  1406. X        endofhistory();
  1407. X}
  1408. X
  1409. Xvoid endofhistory() /**/
  1410. X{
  1411. X    if (histline == curhist) {
  1412. X        if (unset(NOHISTBEEP)) feep();
  1413. X    } else
  1414. X        {
  1415. X        histline = curhist;
  1416. X        sethistline(curhistline);
  1417. X        }
  1418. X}
  1419. X
  1420. Xvoid insertlastword() /**/
  1421. X{
  1422. Xchar *s,*t;
  1423. Xint len,z = lithist;
  1424. X
  1425. X    /* multiple calls will now search back through the history, pem */
  1426. X    static char    *lastinsert;
  1427. X    static int    lasthist, lastpos;
  1428. X    int        evhist = curhist - 1;
  1429. X
  1430. X    if (lastinsert) {
  1431. X        int len = strlen(lastinsert);
  1432. X        int pos = cs;
  1433. X        if (    lastpos <= pos &&
  1434. X            len == pos - lastpos &&
  1435. X            strncmp(lastinsert, (char *) &line[lastpos], len) == 0) {
  1436. X        evhist = --lasthist;
  1437. X        cs = lastpos;
  1438. X        foredel(pos-cs);
  1439. X        }
  1440. X        free(lastinsert);
  1441. X        lastinsert = NULL;
  1442. X    }
  1443. X    lithist = 0;
  1444. X    if (!(s = qgetevent(evhist), lithist = z, s))
  1445. X        {
  1446. X        feep();
  1447. X        return;
  1448. X        }
  1449. X    for (t = s+strlen(s); t > s; t--)
  1450. X        if (*t == HISTSPACE)
  1451. X            break;
  1452. X    if (t != s)
  1453. X        t++;
  1454. X    lasthist = evhist;
  1455. X    lastpos = cs;
  1456. X    lastinsert = ztrdup(t);
  1457. X    spaceinline(len = strlen(t));
  1458. X    strncpy((char *) line+cs,t,len);
  1459. X    cs += len;
  1460. X}
  1461. X
  1462. Xchar *qgetevent(ev) /**/
  1463. Xint ev;
  1464. X{
  1465. X    if (ev > curhist)
  1466. X        return NULL;
  1467. X    return ((ev == curhist) ? curhistline : quietgetevent(ev));
  1468. X}
  1469. X
  1470. Xvoid pushline() /**/
  1471. X{
  1472. X    if (mult < 0) return;
  1473. X    pushnode(bufstack,ztrdup(line));
  1474. X    while (--mult)
  1475. X        pushnode(bufstack,ztrdup(""));
  1476. X    stackcs = cs;
  1477. X    *line = '\0';
  1478. X    ll = cs = 0;
  1479. X}
  1480. X
  1481. Xvoid getline() /**/
  1482. X{
  1483. Xchar *s = getnode(bufstack);
  1484. X
  1485. X    if (!s)
  1486. X        feep();
  1487. X    else
  1488. X        {
  1489. X        int cc;
  1490. X
  1491. X        cc = strlen(s);
  1492. X        spaceinline(cc);
  1493. X        strncpy((char *) line+cs,s,cc);
  1494. X        cs += cc;
  1495. X        free(s);
  1496. X        }
  1497. X}
  1498. X
  1499. Xvoid historyincrementalsearchbackward() /**/
  1500. X{
  1501. X    doisearch(-1);
  1502. X}
  1503. X
  1504. Xvoid historyincrementalsearchforward() /**/
  1505. X{
  1506. X    doisearch(1);
  1507. X}
  1508. X
  1509. Xvoid doisearch(dir) /**/
  1510. Xint dir;
  1511. X{
  1512. Xchar *s,*oldl;
  1513. Xchar ibuf[256],*sbuf = ibuf+10;
  1514. Xint sbptr = 0,ch,ohl = histline,ocs = cs;
  1515. Xint nomatch = 0,chequiv = 0;
  1516. X
  1517. X    strcpy(ibuf,"i-search: ");
  1518. X    statusline = ibuf;
  1519. X    oldl = ztrdup(line);
  1520. X    if (histline == curhist)
  1521. X        {
  1522. X        if (curhistline)
  1523. X            free(curhistline);
  1524. X        curhistline = ztrdup(line);
  1525. X        }
  1526. X    for (;;)
  1527. X        {
  1528. X        nomatch = 0;
  1529. X        if (sbptr > 1 || (sbptr == 1 && sbuf[0] != '^'))
  1530. X            {
  1531. X            int ohistline = histline;
  1532. X
  1533. X            for (;;)
  1534. X                {
  1535. X                char *t;
  1536. X
  1537. X                if (!(s = qgetevent(histline)))
  1538. X                    {
  1539. X                    feep();
  1540. X                    nomatch = 1;
  1541. X                    histline = ohistline;
  1542. X                    break;
  1543. X                    }
  1544. X                if ((sbuf[0] == '^') ?
  1545. X                        (t = (hstrncmp(s,sbuf+1,sbptr-1)) ? NULL : s) :
  1546. X                        (t = hstrnstr(s,sbuf,sbptr)))
  1547. X                    if (!(chequiv && !hstrcmp(line,s)))
  1548. X                        {
  1549. X                        sethistline(s);
  1550. X                        cs = t-s+sbptr-(sbuf[0] == '^');
  1551. X                        break;
  1552. X                        }
  1553. X                histline += dir;
  1554. X                }
  1555. X            chequiv = 0;
  1556. X            }
  1557. X        refresh();
  1558. X        if ((ch = getkey(1)) == -1)
  1559. X            break;
  1560. X        if (ch == 22 || ch == 17) {
  1561. X            if ((ch = getkey(1)) == -1)
  1562. X                break;
  1563. X        } else if (ch == 24) { /* ^XS and ^XR */
  1564. X            if ((ch = getkey(1)) == -1)
  1565. X                break;
  1566. X            if (ch != 's' && ch != 'r') {
  1567. X                ungetkey(24);
  1568. X                ungetkey(ch);
  1569. X                break;
  1570. X            }
  1571. X            ungetkey(ch & 0x1f);
  1572. X            continue;
  1573. X        } else if (ch == 8 || ch == 127) {
  1574. X            if (sbptr)
  1575. X                sbuf[--sbptr] = '\0';
  1576. X            else
  1577. X                feep();
  1578. X            histline = ohl;
  1579. X            continue;
  1580. X        } else if (ch == 7 || ch == 3) {
  1581. X            setline(oldl);
  1582. X            cs = ocs;
  1583. X            histline = ohl;
  1584. X            statusline = NULL;
  1585. X            break;
  1586. X        } else if (ch == 27)
  1587. X            break;
  1588. X        else if (ch == 10 || ch == 13) {
  1589. X            ungetkey(ch);
  1590. X            break;
  1591. X        } else if (ch == 18) {
  1592. X            ohl = (histline += (dir = -1));
  1593. X            chequiv = 1;
  1594. X            continue;
  1595. X        } else if (ch == 19) {
  1596. X            ohl = (histline += (dir = 1));
  1597. X            chequiv = 1;
  1598. X            continue;
  1599. X        } else if (!(ch & 0x60)) {
  1600. X            ungetkey(ch);
  1601. X            break;
  1602. X        }
  1603. X        if (!nomatch && sbptr != 39 && !icntrl(ch)) {
  1604. X            sbuf[sbptr++] = ch;
  1605. X            sbuf[sbptr] = '\0';
  1606. X        }
  1607. X    }
  1608. X    free(oldl);
  1609. X    statusline = NULL;
  1610. X}
  1611. X
  1612. Xvoid acceptandinfernexthistory() /**/
  1613. X{
  1614. Xint t0;
  1615. Xchar *s,*t;
  1616. X
  1617. X    done = 1;
  1618. X    for (t0 = histline-2;;t0--)
  1619. X        {
  1620. X        if (!(s = qgetevent(t0)))
  1621. X            return;
  1622. X        if (!hstrncmp(s,line,ll))
  1623. X            break;
  1624. X        }
  1625. X    if (!(s = qgetevent(t0+1)))
  1626. X        return;
  1627. X    pushnode(bufstack,t = ztrdup(s));
  1628. X    for (; *t; t++)
  1629. X        if (*t == HISTSPACE)
  1630. X            *t = ' ';
  1631. X    stackhist = t0+1;
  1632. X}
  1633. X
  1634. Xvoid infernexthistory() /**/
  1635. X{
  1636. Xint t0;
  1637. Xchar *s,*t;
  1638. X
  1639. X    if (!(t = qgetevent(histline-1)))
  1640. X        {
  1641. X        feep();
  1642. X        return;
  1643. X        }
  1644. X    for (t0 = histline-2;;t0--)
  1645. X        {
  1646. X        if (!(s = qgetevent(t0)))
  1647. X            {
  1648. X            feep();
  1649. X            return;
  1650. X            }
  1651. X        if (!strcmp(s,t))
  1652. X            break;
  1653. X        }
  1654. X    if (!(s = qgetevent(t0+1)))
  1655. X        {
  1656. X        feep();
  1657. X        return;
  1658. X        }
  1659. X    histline = t0+1;
  1660. X    sethistline(s);
  1661. X}
  1662. X
  1663. Xvoid vifetchhistory() /**/
  1664. X{
  1665. Xchar *s;
  1666. X
  1667. X    if (mult < 0) return;
  1668. X    if (histline == curhist) {
  1669. X        if (!(lastcmd & ZLE_ARG)) {
  1670. X            cs = ll;
  1671. X            cs = findbol();
  1672. X            return;
  1673. X        }
  1674. X        if (curhistline)
  1675. X            free(curhistline);
  1676. X        curhistline = ztrdup(line);
  1677. X    }
  1678. X    if (!(lastcmd & ZLE_ARG)) mult = curhist;
  1679. X    if (!(s = qgetevent(mult)))
  1680. X        feep();
  1681. X    else {
  1682. X        histline = mult;
  1683. X        sethistline(s);
  1684. X    }
  1685. X}
  1686. X
  1687. Xint getvisrchstr() /**/
  1688. X{
  1689. Xchar sbuf[80];
  1690. Xint sptr = 1;
  1691. X
  1692. X    if (visrchstr)
  1693. X        {
  1694. X        free(visrchstr);
  1695. X        visrchstr = NULL;
  1696. X        }
  1697. X    statusline = sbuf;
  1698. X    sbuf[0] = c;
  1699. X    sbuf[1] = '\0';
  1700. X    while (sptr)
  1701. X        {
  1702. X        refresh();
  1703. X        c = getkey(0);
  1704. X        if (c == '\r' || c == '\n' || c == '\033')
  1705. X            {
  1706. X            visrchstr = ztrdup(sbuf+1);
  1707. X            return 1;
  1708. X            }
  1709. X        if (c == '\b' || c == 127)
  1710. X            {
  1711. X            sbuf[--sptr] = '\0';
  1712. X            continue;
  1713. X            }
  1714. X        if (sptr != 79)
  1715. X            {
  1716. X            sbuf[sptr++] = c;
  1717. X            sbuf[sptr] = '\0';
  1718. X            }
  1719. X        }
  1720. X    return 0;
  1721. X}
  1722. X
  1723. Xvoid vihistorysearchforward() /**/
  1724. X{
  1725. X    visrchsense = 1;
  1726. X    if (getvisrchstr())
  1727. X        virepeatsearch();
  1728. X}
  1729. X
  1730. Xvoid vihistorysearchbackward() /**/
  1731. X{
  1732. X    visrchsense = -1;
  1733. X    if (getvisrchstr())
  1734. X        virepeatsearch();
  1735. X}
  1736. X
  1737. Xvoid virepeatsearch() /**/
  1738. X{
  1739. Xint ohistline = histline,t0;
  1740. Xchar *s;
  1741. X
  1742. X    if (!visrchstr)
  1743. X        {
  1744. X        feep();
  1745. X        return;
  1746. X        }
  1747. X    t0 = strlen(visrchstr);
  1748. X    if (histline == curhist)
  1749. X        {
  1750. X        if (curhistline)
  1751. X            free(curhistline);
  1752. X        curhistline = ztrdup(line);
  1753. X        }
  1754. X    for (;;)
  1755. X        {
  1756. X        histline += visrchsense;
  1757. X        if (!(s = qgetevent(histline)))
  1758. X            {
  1759. X            feep();
  1760. X            histline = ohistline;
  1761. X            return;
  1762. X            }
  1763. X        if (!hstrcmp(line,s))
  1764. X            continue;
  1765. X        if (*visrchstr == '^')
  1766. X            {
  1767. X            if (!hstrncmp(s,visrchstr+1,t0-1))
  1768. X                break;
  1769. X            }
  1770. X        else
  1771. X            if (hstrnstr(s,visrchstr,t0))
  1772. X                break;
  1773. X        }
  1774. X    sethistline(s);
  1775. X}
  1776. X
  1777. Xvoid virevrepeatsearch() /**/
  1778. X{
  1779. X    visrchsense = -visrchsense;
  1780. X    virepeatsearch();
  1781. X    visrchsense = -visrchsense;
  1782. X}
  1783. X
  1784. SHAR_EOF
  1785. chmod 0644 zsh2.2/src/zle_hist.c ||
  1786. echo 'restore of zsh2.2/src/zle_hist.c failed'
  1787. Wc_c="`wc -c < 'zsh2.2/src/zle_hist.c'`"
  1788. test 10080 -eq "$Wc_c" ||
  1789.     echo 'zsh2.2/src/zle_hist.c: original size 10080, current size' "$Wc_c"
  1790. rm -f _shar_wnt_.tmp
  1791. fi
  1792. # ============= zsh2.2/src/zle_hist.pro ==============
  1793. if test -f 'zsh2.2/src/zle_hist.pro' -a X"$1" != X"-c"; then
  1794.     echo 'x - skipping zsh2.2/src/zle_hist.pro (File already exists)'
  1795.     rm -f _shar_wnt_.tmp
  1796. else
  1797. > _shar_wnt_.tmp
  1798. echo 'x - extracting zsh2.2/src/zle_hist.pro (Text)'
  1799. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/zle_hist.pro' &&
  1800. Xvoid toggleliteralhistory DCLPROTO((void));
  1801. Xvoid uphistory DCLPROTO((void));
  1802. Xvoid uplineorhistory DCLPROTO((void));
  1803. Xvoid downlineorhistory DCLPROTO((void));
  1804. Xvoid acceptlineanddownhistory DCLPROTO((void));
  1805. Xvoid downhistory DCLPROTO((void));
  1806. Xvoid historysearchbackward DCLPROTO((void));
  1807. Xvoid historysearchforward DCLPROTO((void));
  1808. Xvoid beginningofbufferorhistory DCLPROTO((void));
  1809. Xvoid beginningofhistory DCLPROTO((void));
  1810. Xvoid endofbufferorhistory DCLPROTO((void));
  1811. Xvoid endofhistory DCLPROTO((void));
  1812. Xvoid insertlastword DCLPROTO((void));
  1813. Xchar *qgetevent DCLPROTO((int ev));
  1814. Xvoid pushline DCLPROTO((void));
  1815. Xvoid getline DCLPROTO((void));
  1816. Xvoid historyincrementalsearchbackward DCLPROTO((void));
  1817. Xvoid historyincrementalsearchforward DCLPROTO((void));
  1818. Xvoid doisearch DCLPROTO((int dir));
  1819. Xvoid acceptandinfernexthistory DCLPROTO((void));
  1820. Xvoid infernexthistory DCLPROTO((void));
  1821. Xvoid vifetchhistory DCLPROTO((void));
  1822. Xint getvisrchstr DCLPROTO((void));
  1823. Xvoid vihistorysearchforward DCLPROTO((void));
  1824. Xvoid vihistorysearchbackward DCLPROTO((void));
  1825. Xvoid virepeatsearch DCLPROTO((void));
  1826. Xvoid virevrepeatsearch DCLPROTO((void));
  1827. SHAR_EOF
  1828. chmod 0644 zsh2.2/src/zle_hist.pro ||
  1829. echo 'restore of zsh2.2/src/zle_hist.pro failed'
  1830. Wc_c="`wc -c < 'zsh2.2/src/zle_hist.pro'`"
  1831. test 1119 -eq "$Wc_c" ||
  1832.     echo 'zsh2.2/src/zle_hist.pro: original size 1119, current size' "$Wc_c"
  1833. rm -f _shar_wnt_.tmp
  1834. fi
  1835. # ============= zsh2.2/src/zle_misc.pro ==============
  1836. if test -f 'zsh2.2/src/zle_misc.pro' -a X"$1" != X"-c"; then
  1837.     echo 'x - skipping zsh2.2/src/zle_misc.pro (File already exists)'
  1838.     rm -f _shar_wnt_.tmp
  1839. else
  1840. > _shar_wnt_.tmp
  1841. echo 'x - extracting zsh2.2/src/zle_misc.pro (Text)'
  1842. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/zle_misc.pro' &&
  1843. Xvoid selfinsert DCLPROTO((void));
  1844. Xvoid selfinsertunmeta DCLPROTO((void));
  1845. Xvoid deletechar DCLPROTO((void));
  1846. Xvoid backwarddeletechar DCLPROTO((void));
  1847. Xvoid videletechar DCLPROTO((void));
  1848. Xvoid vibackwarddeletechar DCLPROTO((void));
  1849. Xvoid vikillline DCLPROTO((void));
  1850. Xvoid killwholeline DCLPROTO((void));
  1851. Xvoid killbuffer DCLPROTO((void));
  1852. Xvoid backwardkillline DCLPROTO((void));
  1853. Xvoid gosmacstransposechars DCLPROTO((void));
  1854. Xvoid transposechars DCLPROTO((void));
  1855. Xvoid poundinsert DCLPROTO((void));
  1856. Xvoid acceptline DCLPROTO((void));
  1857. Xvoid acceptandhold DCLPROTO((void));
  1858. Xvoid killline DCLPROTO((void));
  1859. Xvoid killregion DCLPROTO((void));
  1860. Xvoid copyregionaskill DCLPROTO((void));
  1861. Xvoid yank DCLPROTO((void));
  1862. Xvoid viputafter DCLPROTO((void));
  1863. Xvoid yankpop DCLPROTO((void));
  1864. Xvoid overwritemode DCLPROTO((void));
  1865. Xvoid undefinedkey DCLPROTO((void));
  1866. Xvoid quotedinsert DCLPROTO((void));
  1867. Xvoid digitargument DCLPROTO((void));
  1868. Xvoid negargument DCLPROTO((void));
  1869. Xvoid universalargument DCLPROTO((void));
  1870. Xvoid copyprevword DCLPROTO((void));
  1871. Xvoid sendbreak DCLPROTO((void));
  1872. Xvoid undo DCLPROTO((void));
  1873. Xvoid quoteregion DCLPROTO((void));
  1874. Xvoid quoteline DCLPROTO((void));
  1875. Xchar *makequote DCLPROTO((char *s));
  1876. Xint executenamedcommand DCLPROTO((void));
  1877. Xvoid vijoin DCLPROTO((void));
  1878. Xvoid viswapcase DCLPROTO((void));
  1879. Xvoid vicapslockpanic DCLPROTO((void));
  1880. Xvoid visetbuffer DCLPROTO((void));
  1881. Xvoid stradd DCLPROTO((char *d));
  1882. Xint putstr DCLPROTO((int d));
  1883. Xchar *putprompt DCLPROTO((char *fm,int *lenp));
  1884. SHAR_EOF
  1885. chmod 0644 zsh2.2/src/zle_misc.pro ||
  1886. echo 'restore of zsh2.2/src/zle_misc.pro failed'
  1887. Wc_c="`wc -c < 'zsh2.2/src/zle_misc.pro'`"
  1888. test 1478 -eq "$Wc_c" ||
  1889.     echo 'zsh2.2/src/zle_misc.pro: original size 1478, current size' "$Wc_c"
  1890. rm -f _shar_wnt_.tmp
  1891. fi
  1892. # ============= zsh2.2/src/zle_move.pro ==============
  1893. if test -f 'zsh2.2/src/zle_move.pro' -a X"$1" != X"-c"; then
  1894.     echo 'x - skipping zsh2.2/src/zle_move.pro (File already exists)'
  1895.     rm -f _shar_wnt_.tmp
  1896. else
  1897. > _shar_wnt_.tmp
  1898. echo 'x - extracting zsh2.2/src/zle_move.pro (Text)'
  1899. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/zle_move.pro' &&
  1900. Xvoid beginningofline DCLPROTO((void));
  1901. Xvoid endofline DCLPROTO((void));
  1902. Xvoid beginningoflinehist DCLPROTO((void));
  1903. Xvoid endoflinehist DCLPROTO((void));
  1904. Xvoid forwardchar DCLPROTO((void));
  1905. Xvoid backwardchar DCLPROTO((void));
  1906. Xvoid setmarkcommand DCLPROTO((void));
  1907. Xvoid exchangepointandmark DCLPROTO((void));
  1908. Xvoid vigotocolumn DCLPROTO((void));
  1909. Xvoid vimatchbracket DCLPROTO((void));
  1910. Xvoid viforwardchar DCLPROTO((void));
  1911. Xvoid vibackwardchar DCLPROTO((void));
  1912. Xvoid viendofline DCLPROTO((void));
  1913. Xvoid vibeginningofline DCLPROTO((void));
  1914. Xvoid vifindnextchar DCLPROTO((void));
  1915. Xvoid vifindprevchar DCLPROTO((void));
  1916. Xvoid vifindnextcharskip DCLPROTO((void));
  1917. Xvoid vifindprevcharskip DCLPROTO((void));
  1918. Xvoid virepeatfind DCLPROTO((void));
  1919. Xvoid virevrepeatfind DCLPROTO((void));
  1920. Xvoid vifirstnonblank DCLPROTO((void));
  1921. Xvoid visetmark DCLPROTO((void));
  1922. Xvoid vigotomark DCLPROTO((void));
  1923. Xvoid vigotomarkline DCLPROTO((void));
  1924. SHAR_EOF
  1925. chmod 0644 zsh2.2/src/zle_move.pro ||
  1926. echo 'restore of zsh2.2/src/zle_move.pro failed'
  1927. Wc_c="`wc -c < 'zsh2.2/src/zle_move.pro'`"
  1928. test 909 -eq "$Wc_c" ||
  1929.     echo 'zsh2.2/src/zle_move.pro: original size 909, current size' "$Wc_c"
  1930. rm -f _shar_wnt_.tmp
  1931. fi
  1932. # ============= zsh2.2/src/zle_word.pro ==============
  1933. if test -f 'zsh2.2/src/zle_word.pro' -a X"$1" != X"-c"; then
  1934.     echo 'x - skipping zsh2.2/src/zle_word.pro (File already exists)'
  1935.     rm -f _shar_wnt_.tmp
  1936. else
  1937. > _shar_wnt_.tmp
  1938. echo 'x - extracting zsh2.2/src/zle_word.pro (Text)'
  1939. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/zle_word.pro' &&
  1940. Xvoid forwardword DCLPROTO((void));
  1941. Xvoid viforwardword DCLPROTO((void));
  1942. Xvoid viforwardblankword DCLPROTO((void));
  1943. Xvoid emacsforwardword DCLPROTO((void));
  1944. Xvoid viforwardblankwordend DCLPROTO((void));
  1945. Xvoid viforwardwordend DCLPROTO((void));
  1946. Xvoid backwardword DCLPROTO((void));
  1947. Xvoid vibackwardword DCLPROTO((void));
  1948. Xvoid vibackwardblankword DCLPROTO((void));
  1949. Xvoid emacsbackwardword DCLPROTO((void));
  1950. Xvoid backwarddeleteword DCLPROTO((void));
  1951. Xvoid vibackwardkillword DCLPROTO((void));
  1952. Xvoid backwardkillword DCLPROTO((void));
  1953. Xvoid upcaseword DCLPROTO((void));
  1954. Xvoid downcaseword DCLPROTO((void));
  1955. Xvoid capitalizeword DCLPROTO((void));
  1956. Xvoid deleteword DCLPROTO((void));
  1957. Xvoid killword DCLPROTO((void));
  1958. Xvoid transposewords DCLPROTO((void));
  1959. SHAR_EOF
  1960. chmod 0644 zsh2.2/src/zle_word.pro ||
  1961. echo 'restore of zsh2.2/src/zle_word.pro failed'
  1962. Wc_c="`wc -c < 'zsh2.2/src/zle_word.pro'`"
  1963. test 733 -eq "$Wc_c" ||
  1964.     echo 'zsh2.2/src/zle_word.pro: original size 733, current size' "$Wc_c"
  1965. rm -f _shar_wnt_.tmp
  1966. fi
  1967. # ============= zsh2.2/src/config.h ==============
  1968. if test -f 'zsh2.2/src/config.h' -a X"$1" != X"-c"; then
  1969.     echo 'x - skipping zsh2.2/src/config.h (File already exists)'
  1970.     rm -f _shar_wnt_.tmp
  1971. else
  1972. > _shar_wnt_.tmp
  1973. echo 'x - extracting zsh2.2/src/config.h (Text)'
  1974. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/config.h' &&
  1975. X/* this file is created automatically by buildzsh */
  1976. X
  1977. X/* define this if you are sysvish */
  1978. X/* #define SYSV */
  1979. X
  1980. X#define TERMIOS
  1981. X/* #define TTY_NEEDS_DRAINING */
  1982. X/* #define CLOBBERS_TYPEAHEAD */
  1983. X
  1984. X#define HAS_STDLIB
  1985. X
  1986. X#define HAS_STRING
  1987. X
  1988. X#define HAS_LOCALE
  1989. X
  1990. X/* define this if you have a host field in utmp */
  1991. X#define UTMP_HOST
  1992. X
  1993. X/* define this if you have WAITPID */
  1994. X#define WAITPID
  1995. X
  1996. X/* define this if you have SELECT */
  1997. X#define HAS_SELECT
  1998. X
  1999. X/* define this if you have <sys/select.h> */
  2000. X/* #define HAS_SYS_SELECT */
  2001. X
  2002. X/* we can't just test for S_IFIFO or check to see if the mknod worked,
  2003. X   because the NeXTs sold by a vendor which will remain nameless will
  2004. X   happily create the FIFO for you, and then panic when you try to do
  2005. X    something weird with them, because they aren't supported by the OS. */
  2006. X
  2007. X/* #define NO_FIFOS */
  2008. X
  2009. X/* define this if you have strftime() */
  2010. X#define HAS_STRFTIME
  2011. X
  2012. X#define HAS_TCSETPGRP
  2013. X
  2014. X#define HAS_TCCRAP
  2015. X
  2016. X#define HAS_SETPGID
  2017. X
  2018. X/* #define HAS_SIGRELSE */
  2019. X
  2020. X/* define this if you have RFS */
  2021. X/* #define HAS_RFS */
  2022. X
  2023. X/* define this if you have a working getrusage and wait3 */
  2024. X#define HAS_RUSAGE
  2025. X
  2026. X/* define this if your signal handlers return void */
  2027. X#define SIGVOID
  2028. X#ifdef sgi
  2029. X#undef SIGVOID
  2030. X#endif
  2031. X
  2032. X/* define this if signal handlers need to be reset each time */
  2033. X/* #define RESETHANDNEEDED */
  2034. X
  2035. X#ifdef SIGVOID
  2036. X#define HANDTYPE void
  2037. X#else
  2038. X#define HANDTYPE int
  2039. X#define INTHANDTYPE
  2040. X#endif
  2041. X
  2042. X/* a string corresponding to the host type */
  2043. X#define HOSTTYPE "sun4"
  2044. X
  2045. X/* the default editor for the fc builtin */
  2046. X#define DEFFCEDIT "vi"
  2047. X
  2048. X/* the path of wtmp */
  2049. X#define WTMP_FILE "/var/adm/wtmp"
  2050. X
  2051. X/* the path of utmp */
  2052. X#define UTMP_FILE "/etc/utmp"
  2053. X
  2054. X/* default prefix for temporary files */
  2055. X#define DEFTMPPREFIX "/tmp/zsh"
  2056. X
  2057. X/* define if you prefer "suspended" to "stopped" */
  2058. X#define USE_SUSPENDED
  2059. X
  2060. X/* the file to source whenever zsh is run; if undefined, don't source
  2061. X    anything */
  2062. X#define GLOBALZSHRC "/etc/zshrc"
  2063. X
  2064. X/* the file to source whenever zsh is run as a login shell; if
  2065. X    undefined, don't source anything */
  2066. X#define GLOBALZLOGIN "/etc/zlogin"
  2067. X
  2068. X/* the file to source whenever zsh is run as a login shell, before
  2069. X    zshrc is read; if undefined, don't source anything */
  2070. X#define GLOBALZPROFILE "/etc/zprofile"
  2071. X
  2072. X/* the default HISTSIZE */
  2073. X#define DEFAULT_HISTSIZE 30
  2074. X
  2075. X#define _BSD_SIGNALS   /* this could be an iris, you never know */
  2076. X#define _BSD           /* this could be HP-UX, you never know */
  2077. X#define _BSD_INCLUDES  /* this could be AIX, you never know */
  2078. X
  2079. X/* if your compiler doesn't like void *, change this to char *
  2080. X    and ignore all the warnings.
  2081. X*/
  2082. X
  2083. Xtypedef void *vptr;
  2084. X
  2085. X#define JOB_CONTROL
  2086. SHAR_EOF
  2087. chmod 0644 zsh2.2/src/config.h ||
  2088. echo 'restore of zsh2.2/src/config.h failed'
  2089. Wc_c="`wc -c < 'zsh2.2/src/config.h'`"
  2090. test 2607 -eq "$Wc_c" ||
  2091.     echo 'zsh2.2/src/config.h: original size 2607, current size' "$Wc_c"
  2092. rm -f _shar_wnt_.tmp
  2093. fi
  2094. # ============= zsh2.2/src/signals.h ==============
  2095. if test -f 'zsh2.2/src/signals.h' -a X"$1" != X"-c"; then
  2096.     echo 'x - skipping zsh2.2/src/signals.h (File already exists)'
  2097.     rm -f _shar_wnt_.tmp
  2098. else
  2099. > _shar_wnt_.tmp
  2100. echo 'x - extracting zsh2.2/src/signals.h (Text)'
  2101. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/signals.h' &&
  2102. X/* this file is created automatically by buildzsh */
  2103. X/* if all this is wrong, blame csh ;-) */
  2104. X
  2105. X#define SIGCOUNT       31
  2106. X
  2107. X#ifdef GLOBALS
  2108. X
  2109. Xchar *sigmsg[SIGCOUNT+2] = {
  2110. X    "done",
  2111. X    "hangup",
  2112. X    "interrupt",
  2113. X    "quit",
  2114. X    "illegal instruction",
  2115. X    "trace trap",
  2116. X    "abort",
  2117. X    "EMT instruction",
  2118. X    "floating point exception",
  2119. X    "killed",
  2120. X    "bus error",
  2121. X    "segmentation fault",
  2122. X    "bad system call",
  2123. X    "broken pipe",
  2124. X    "SIGALRM",
  2125. X    "terminated",
  2126. X    "SIGURG",
  2127. X#ifdef USE_SUSPENDED
  2128. X    "suspended (signal)",
  2129. X#else
  2130. X    "stopped (signal)",
  2131. X#endif
  2132. X#ifdef USE_SUSPENDED
  2133. X    "suspended",
  2134. X#else
  2135. X    "stopped",
  2136. X#endif
  2137. X    "continued",
  2138. X    "SIGCHLD",
  2139. X#ifdef USE_SUSPENDED
  2140. X    "suspended (tty input)",
  2141. X#else
  2142. X    "stopped (tty input)",
  2143. X#endif
  2144. X#ifdef USE_SUSPENDED
  2145. X    "suspended (tty output)",
  2146. X#else
  2147. X    "stopped (tty output)",
  2148. X#endif
  2149. X    "SIGIO",
  2150. X    "cpu limit exceeded",
  2151. X    "filesize limit exceeded",
  2152. X    "virtual time alarm",
  2153. X    "SIGPROF",
  2154. X    "SIGWINCH",
  2155. X    "SIGLOST",
  2156. X    "SIGUSR1",
  2157. X    "SIGUSR2",
  2158. X    NULL
  2159. X};
  2160. X
  2161. Xchar *sigs[SIGCOUNT+4] = {
  2162. X    "EXIT",
  2163. X    "HUP",
  2164. X    "INT",
  2165. X    "QUIT",
  2166. X    "ILL",
  2167. X    "TRAP",
  2168. X    "ABRT",
  2169. X    "EMT",
  2170. X    "FPE",
  2171. X    "KILL",
  2172. X    "BUS",
  2173. X    "SEGV",
  2174. X    "SYS",
  2175. X    "PIPE",
  2176. X    "ALRM",
  2177. X    "TERM",
  2178. X    "URG",
  2179. X    "STOP",
  2180. X    "TSTP",
  2181. X    "CONT",
  2182. X    "CHLD",
  2183. X    "TTIN",
  2184. X    "TTOU",
  2185. X    "IO",
  2186. X    "XCPU",
  2187. X    "XFSZ",
  2188. X    "VTALRM",
  2189. X    "PROF",
  2190. X    "WINCH",
  2191. X    "LOST",
  2192. X    "USR1",
  2193. X    "USR2",
  2194. X    "ERR",
  2195. X    "DEBUG",
  2196. X    NULL
  2197. X};
  2198. X
  2199. X#else
  2200. X
  2201. Xextern char *sigs[SIGCOUNT+4],*sigmsg[SIGCOUNT+2];
  2202. X
  2203. X#endif
  2204. SHAR_EOF
  2205. chmod 0644 zsh2.2/src/signals.h ||
  2206. echo 'restore of zsh2.2/src/signals.h failed'
  2207. Wc_c="`wc -c < 'zsh2.2/src/signals.h'`"
  2208. test 1322 -eq "$Wc_c" ||
  2209.     echo 'zsh2.2/src/signals.h: original size 1322, current size' "$Wc_c"
  2210. rm -f _shar_wnt_.tmp
  2211. fi
  2212. # ============= zsh2.2/src/Makefile ==============
  2213. if test -f 'zsh2.2/src/Makefile' -a X"$1" != X"-c"; then
  2214.     echo 'x - skipping zsh2.2/src/Makefile (File already exists)'
  2215.     rm -f _shar_wnt_.tmp
  2216. else
  2217. > _shar_wnt_.tmp
  2218. echo 'x - extracting zsh2.2/src/Makefile (Text)'
  2219. sed 's/^X//' << 'SHAR_EOF' > 'zsh2.2/src/Makefile' &&
  2220. X#! /bin/make -f
  2221. X# Makefile for zsh
  2222. X# generated by buildzsh
  2223. X
  2224. XOBJS=builtin.o cond.o exec.o glob.o hist.o init.o jobs.o lex.o loop.o \
  2225. Xmath.o mem.o params.o parse.o subst.o table.o text.o utils.o watch.o \
  2226. Xzle_bindings.o zle_hist.o zle_main.o zle_misc.o zle_move.o zle_refresh.o \
  2227. Xzle_tricky.o zle_utils.o zle_vi.o zle_word.o
  2228. X
  2229. XBINDIR=/usr/local/bin
  2230. XMANDIR=/usr/local/man/man1
  2231. X
  2232. X# debugging flags
  2233. X#CFLAGS=-g -Wreturn-type -Wunused -Wpointer-arith -DQDEBUG
  2234. X#CC=gcc -traditional
  2235. X
  2236. XCC=cc
  2237. XCFLAGS= -O
  2238. XLIBS= -ltermcap
  2239. X
  2240. XZSHPATH=zsh
  2241. X
  2242. X.c.o:
  2243. X    $(CC) $(CFLAGS) -c $<
  2244. X
  2245. Xall: $(ZSHPATH)
  2246. X
  2247. X$(ZSHPATH): $(OBJS)
  2248. X    $(CC) -o $(ZSHPATH) $(OBJS) $(LIBS) $(LFLAGS)
  2249. X    
  2250. Xtags: /tmp
  2251. X    ctags *.[cy]
  2252. X
  2253. X# I hate this next line
  2254. X$(OBJS): config.h zsh.h zle.h signals.h ztype.h funcs.h
  2255. X
  2256. Xclean:
  2257. X    rm -f *.o zsh core 
  2258. X
  2259. Xcleanall:
  2260. X    rm -f *.o zsh core Makefile signals.h config.h
  2261. X
  2262. Xinstall: zsh
  2263. X    install -s -m 755 zsh $(BINDIR)
  2264. X    install -m 444 ../man/man1/zsh.1 $(MANDIR)
  2265. SHAR_EOF
  2266. chmod 0644 zsh2.2/src/Makefile ||
  2267. echo 'restore of zsh2.2/src/Makefile failed'
  2268. Wc_c="`wc -c < 'zsh2.2/src/Makefile'`"
  2269. test 921 -eq "$Wc_c" ||
  2270.     echo 'zsh2.2/src/Makefile: original size 921, current size' "$Wc_c"
  2271. rm -f _shar_wnt_.tmp
  2272. fi
  2273. rm -f _shar_seq_.tmp
  2274. echo You have unpacked the last part
  2275. exit 0
  2276.  
  2277. exit 0 # Just in case...
  2278.